﻿/*  --------------------------------------------------------------------------------------------------------------
 *  I Software Innovations
 *  --------------------------------------------------------------------------------------------------------------
 *  SVG Artieste 2.0
 *  --------------------------------------------------------------------------------------------------------------
 *  File     :       ResizeCommand.cs
 *  Author   :       ajaysbritto@yahoo.com
 *  Date     :       20/03/2010
 *  --------------------------------------------------------------------------------------------------------------
 *  Change Log
 *  --------------------------------------------------------------------------------------------------------------
 *  Author	Comments
 */


using Microsoft.Xna.Framework;
namespace Draw.Command
{
    class ResizeCommand : ICommand
    {

        private readonly XnaDrawObject _itemResized;
        private readonly Point _oldPoint;
        private readonly Point _newPoint;
        private readonly int _handle;

        //Disable default constructor
        private ResizeCommand()
        {
        }

        public ResizeCommand(XnaDrawObject itemResized, Point old, Point newP, int handle)
        {
            _itemResized = itemResized;
            _oldPoint = new Point(old.X, old.Y);
            _newPoint = new Point(newP.X, newP.Y);
            _handle = handle;
        }

        #region ICommand Members

        public void Execute()
        {
            _itemResized.MoveHandleTo(_newPoint, _handle);
        }

        public void UnExecute()
        {
            _itemResized.MoveHandleTo(_oldPoint, _handle);
        }

        #endregion
    }
}